﻿#include "widget.h"
#include "ui_widget.h"

#include <QString>
#include <QDebug>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    wk = new WorkWindow;
    connect(wk,SIGNAL(changeWindow()),this,SLOT(on_btnReLogin_recv()));
}

Widget::~Widget()
{
    delete ui;
    delete wk;
    qDebug()<<"删除ui和wk";
}


void Widget::on_checkBox_stateChanged(int arg1)
{
    if(arg1){
        qDebug()<< arg1;
    }
    else{
        qDebug()<< "not save" << arg1;
    }
}


void Widget::on_btnCancel_clicked()
{
    this->close();  //关闭登录窗口
}


//登录操作
void Widget::on_btnLogin_clicked()
{
    QString username = this->ui->inputAccount->text();
    QString passwd = this->ui->inputPasswd->text();
    qDebug()<<username <<" " << passwd;
    this->hide();
    this->wk->show();
}

// 接受并处理工作窗口发送changewindow信号
void Widget::on_btnReLogin_recv()
{
    this->wk->hide();
    this->show();
}
